import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:geomancy/enums/index.dart';
import 'package:geomancy/styles/index.dart';
import 'package:geomancy/tools/constant.dart';
import 'package:geomancy/widgets/common_header.dart';
import 'package:geomancy/widgets/common_text.dart';
import 'package:geomancy/widgets/common_title.dart';

class StudyResultDetailPage extends StatefulWidget {
  final CompassSource source;
  final double direction;
  final int index;///具体某个宫位的index
  const StudyResultDetailPage({super.key, required this.source, required this.direction, required this.index});

  @override
  State<StudyResultDetailPage> createState() => _WealthResultDetailPageState();
}

class _WealthResultDetailPageState extends State<StudyResultDetailPage> {
  late String themeTxt;

  @override
  void initState() {
    super.initState();
    themeTxt = widget.source == CompassSource.roomStudy ? '房间' : '工位';
  }
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CommonHeader.appBar(context: context),
      backgroundColor: ColorStyle.pageDefaultColor,
      body: ListView(
        physics: const ClampingScrollPhysics(),
        padding: EdgeInsets.fromLTRB(Constant.PAGEPADDING.w, 20.w, Constant.PAGEPADDING.w, 80.w),
        children: [
          CommonTitleWidget(txt: '$themeTxt文昌位'),
          Container(
            margin: EdgeInsets.only(top: 20.w),
            padding: EdgeInsets.fromLTRB(40.w, 30.w, 40.w, 30.w),
            alignment: Alignment.center,
            decoration: BoxDecoration(
                color: ColorStyle.themeLightColor,
                border: Border.all(width: 5.w, color: ColorStyle.borderColor),
                borderRadius: BorderRadius.all(Radius.circular(60.w))
            ),
            child: const Column(
              children: [
                CommonText(txt: '1.可摆放文昌塔（开光后效果更佳）或文昌笔架。7层文昌塔预示学业进步，13层预示功成名就，可结合家中学子年龄选择。', height: 1.5),
                CommonText(txt: '文昌塔注意事项：不宜正对厕所、不宜正对厨房、不宜放置于床头、不宜置于横梁下、不宜对着镜子。', height: 1.5),
                CommonText(txt: '2.家中学子可多在文昌位方位上学习和生活。', height: 1.5),
              ],
            )
          ),
          Container(
            margin: EdgeInsets.symmetric(vertical: 40.w),
            child: Image.asset('assets/grid/grid_study_compass_${widget.index}.png', width: 670.w),
          ),
        ],
      ),
    );
  }
}
